<?php
/**
 * quick_curd
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2025/2/28
 * 描述:
 */

namespace app\result\admin;

use app\model\admin\AdminActionLog;
use app\result\BaseResult;

class AdminActionLogResult extends BaseResult
{
    //操作日志
    public static function add($admin_id, $title, $content): array
    {
        $data = [
            'admin_id' => $admin_id,
            'title' => $title,
            'content' => (is_array($content) || is_object($content)) ? json_encode($content, JSON_UNESCAPED_UNICODE) : $content,
        ];
        $res = (new AdminActionLog)->data_add($data);
        if (!$res) {
            return self::error_return('添加失败');
        }
        return self::success_return('添加成功',);
    }
}
